package example.step2;

import java.io.FileOutputStream;
import java.io.ObjectOutputStream;

public class WrapperSerial {
    public static void main(String[] args) throws Exception {
        ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(
                "E:\\idea-workspace\\gitee\\demo\\serializable\\src\\main\\java\\objfile\\wrapper.obj"));
        // 针对Boolean数据的序列化
        out.writeBoolean(Boolean.TRUE);
        out.writeBoolean(Boolean.FALSE);
        // 针对Short的序列化
        out.writeShort(Short.valueOf("32"));
        // 针对Int的序列化
        out.writeInt(Integer.valueOf("32"));
        // 针对Long的序列化
        out.writeLong(Long.valueOf("32"));
        // 针对Char的序列化
        out.writeChar(Character.valueOf('a'));
        // 针对Byte的序列化
        out.writeByte(Byte.valueOf("12"));
        // 针对Float的序列化
        out.writeFloat(Float.valueOf("32"));
        // 针对Double的序列化
        out.writeDouble(Double.valueOf("3.2"));
        // 封装类型的另外一种方式的序列化

        // 针对Boolean数据的序列化
        out.writeObject(Boolean.TRUE);
        out.writeObject(Boolean.FALSE);
        // 针对Short的序列化
        out.writeObject(Short.valueOf("32"));
        // 针对Int的序列化
        out.writeObject(Integer.valueOf("32"));
        // 针对Long的序列化
        out.writeObject(Long.valueOf("32"));
        // 针对Char的序列化
        out.writeObject(Character.valueOf('a'));
        // 针对Byte的序列化
        out.writeObject(Byte.valueOf("12"));
        // 针对Float的序列化
        out.writeObject(Float.valueOf("32"));
        // 针对Double的序列化
        out.writeObject(Double.valueOf("3.2"));

        out.close();
    }
}